BuffEffect15100 = BaseBuffEffect:new();
BuffEffect15100.__index = BuffEffect15100;

local TRIGGER_PARAMETER = "BuffEffect15100";
local TRIGGER_SKILL = 15103;

function BuffEffect15100:new()
    local object = {};
    setmetatable(object, BuffEffect15100);
    return object;
end

-- 准备技能
function BuffEffect15100.action(fight,buff,...)
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    -- 援护者
    local fighter = buff.source;
    -- 被援护者
    local target = buff.target;

    local result = select('3',...);

    local frame = fight.frame;
    -- 援护者是否已经死亡
    if FighterManager.isDie(fighter) then
        return EnumConst.IBuffEffect.REMOVE;
    end
    -- 援护者和被援护者是否为同一人
    if fighter.fighterId == target.fighterId then
            return EnumConst.IBuffEffect.REMOVE;
    end

    -- 上一次触发时间是否在间隔以内
    local preFrameStr = fighter.paramemters[TRIGGER_PARAMETER];
    if preFrameStr ~= nil and preFrameStr ~= "" then
        local preFrame = toNumber(preFrameStr);
        if frame - preFrame < buffEffectValue[1] / EnumConst.FIGHT_FRAME then
            return EnumConst.IBuffEffect.FAIL;
        end
    end

    fighter.paramemters[TRIGGER_PARAMETER] = tostring(frame);
    -- 把血加回来
    target:setHp(target:getHp() + result.damage);
    -- 触发技能
    this.triggerSkill(fight, fighter, target, TRIGGER_SKILL);
    
    fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff..modelId.." 触发援护");
    return BaseBuffEffect:action(fight, buff, ...);
end